{{include './components/head.html' '发表'}}

<nav class="navbar navbar-default" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" href="/">博客系统</a>
        </div>
        <ul class="nav navbar-nav navbar-right">
            {{if username}}
            <li><a href="/user"><span class="glyphicon glyphicon-user"></span>{{username}}</a></li>
            <li><a href="/layout"><span class="glyphicon glyphicon-log-in"></span>退出</a></li>
            {{else}}
            <li><a href="/register"><span class="glyphicon glyphicon-user"></span> 注册</a></li>
            <li><a href="/login"><span class="glyphicon glyphicon-log-in"></span> 登录</a></li>
            {{/if}}

        </ul>
    </div>
</nav>

<div class="container">
    <div class="well well-lg">
        <form class="form-horizontal" role="form" method="POST" action="/publish">
            <div class="form-group">
                <label for="title" class="col-sm-1 control-label">名字</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="title" placeholder="请输入文章标题" name="title" value="{{title || ''}}">
                </div>
            </div>
            <div class="form-group">
                <label for="post" class="col-sm-1 control-label">文章</label>
                <div class="col-sm-10">
                    <!-- 保存用户书写的信息 -->
                    <textarea class="form-control" rows="10" id="post" placeholder="书写文章吧" name="post" value="{{ post || ''}}"></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-1 col-sm-10">
                    <button type="submit" class="btn btn-default">提交</button>
                </div>
            </div>
        </form>
        {{if error}}
        <div class="alert alert-danger">{{msg}}</div>
        {{/if}}
    </div>
</div>